define(["PDUtilDir/grid", "PDUtilDir/searchBlock"],
    function (Grid, SearchBlock) {

        function init(cache, reserveInfoObj, searchObj) {
            SearchBlock.init('searchBlockId');
            // 初始化
            return Grid({
                id: "CarTeamApplyUpdateGirdDivId",
                pageSize: 10,
                index: true,
                multi: true,
                pagination: true,
                cache: false,
                layout: [{
                    name: "申请人",
                    field: "sendDeptName",
                    sort: true
                }, {
                    name: "订单号",
                    field: "carReserveId"
                }, {
                    name : "修单前价格",
                    field : "totalCost",
                    width : "10%"
                }, {
                    name : "修单后价格",
                    field : "updateTotalCost",
                    width : "10%"
                }, {
                    name: "状态",
                    field: "status",
                    format: function (e) {
                        return cache.statusMap.get(e.row.status);
                    }
                }, {
                    name : "创建时间",
                    sort : true,
                    field : "createTime"
                }, {
                    name: "操作",
                    field: "id",
                    width: '100px',
                    format: function (e) {
                        if (e.row.status == 'D_CAR_REVERCE_APPLY_TO_DO')
                            return '<a href="javascript:angular.element(\'#CarTeamApplyUpdateGirdDivId\').scope().closeSupport.run(\'' + e.row.id + '\')">否定</a>'
                                + '<a href="javascript:angular.element(\'#CarTeamApplyUpdateGirdDivId\').scope().sureSupport.run(\'' + e.row.id + '\')">确认</a>';
                    }
                }],
                toolbar: [
                    {
                        name: "查询",
                        icon: "fa fa-search",
                        callback: function (event) {
                            searchObj.run();
                        }
                    }
                ],
                data: {
                    type: "URL",
                    value: getServer()
                    + "/flea/hclv/car/reserve/update/apply/myReceiveApply.htmls"
                }
            });
        }

        return {
            init: init
        }
    });